package com.admin.util;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.admin.bean.ProvinceBean;
import com.admin.service.ProvinceService;

public class BillingTag extends TagSupport {

	private static final long serialVersionUID = -6637280459426996600L;

	private int provinceId;

	public int getProvinceId() {
		return provinceId;
	}

	public void setProvinceId(int provinceId) {
		this.provinceId = provinceId;
	}
	
	@Override
	public int doStartTag() throws JspException {
		ProvinceBean bean = ProvinceService.getProvince(provinceId);
		if(bean!=null){
			String provinceName = bean.getProvince();
			try {  
	            pageContext.getOut().write(provinceName);  
	        } catch (Throwable cause) {  
	            throw new RuntimeException("自定义按钮标签出错", cause);  
	        } 
		}
        return SKIP_BODY;
	}
}
